package com.db.controller;

import com.db.common.pojo.JsonResult;
import com.db.pojo.SysRole;
import com.db.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/role/")
public class SysRoleController {

    @Autowired
    private SysRoleService sysRoleService;

    @RequestMapping("doFindPageObjects")
    public JsonResult doFindPageObjects(String username, Long pageCurrent) {
        return new JsonResult(sysRoleService.findObjects(username, pageCurrent));
    }

    //doSaveObject
    @RequestMapping("doSaveObject")
    public JsonResult doSaveObject(SysRole sysRole, Integer... menuIds) {
        sysRoleService.insertObject(sysRole, menuIds);
        return new JsonResult("insert ok");
    }
}
